import com.itye.com.ClassRoom;
import com.itye.com.Group;
import com.itye.com.Student;

public class Main {
    public static void main(String[] args) {
        Student student1 = new Student("张三", 202301);
        Student student2 = new Student("李四", 202302);
        Student student3 = new Student("王五", 202303);
        Student student4 = new Student("赵六", 202304);
        Student student5 = new Student("孙七", 202305);
        Student student6 = new Student("周八", 202306);

        // 创建小组对象并添加学生
        Group group1 = new Group(01);
        group1.addStudent(student1);
        group1.addStudent(student2);
        group1.addStudent(student3);

        Group group2 = new Group(02);
        group2.addStudent(student4);
        group2.addStudent(student5);
        group2.addStudent(student6);

        // 创建班级对象并添加小组和学生
        ClassRoom classRoom = new ClassRoom("七班");
        classRoom.addGroup(group1);
        classRoom.addGroup(group2);
        classRoom.addStudent(student1);
        classRoom.addStudent(student2);
        classRoom.addStudent(student3);
        classRoom.addStudent(student4);
        classRoom.addStudent(student5);
        classRoom.addStudent(student6);
        ClassRoom classRoom2 = new ClassRoom("八班");
        classRoom.addGroup(group1);
        classRoom.addGroup(group2);
        classRoom.addStudent(student1);
        classRoom.addStudent(student2);
        classRoom.addStudent(student3);
        classRoom.addStudent(student4);
        classRoom.addStudent(student5);
        classRoom.addStudent(student6);

        // 随机抽取小组
        Group randomGroup = classRoom.getRandomGroup();
        System.out.println("随机抽取的小组编号为：" + randomGroup.getGroupId());

        // 随机抽取小组中的学生
        Student randomStudentInGroup = randomGroup.getRandomStudent();
        if (randomStudentInGroup!= null) {
            System.out.println("随机抽取的小组中的学生为："+ randomStudentInGroup.getName() + "，学号为：" + randomStudentInGroup.getStudentId());
        }

        // 随机从全班抽取学生
        Student randomStudentInClass = classRoom.getRandomStudentFromClass();
        if (randomStudentInClass!= null) {
            System.out.println("随机从全班抽取的学生为：" + randomStudentInClass.getName() + "，学号为：" + randomStudentInClass.getStudentId());
        }
    }
}